package com.xkj.tcpdemo.controller;

import com.xkj.tcpdemo.TcpService.TcpService;
import com.xkj.tcpdemo.model.IpAddress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController()
@RequestMapping("tcp")
public class TcpController {
    @Autowired
    private TcpService tcpService;

    @GetMapping("/send")
    public void send(@RequestBody @Validated IpAddress ipAddress){
        tcpService.redirect(ipAddress);
    }
}
